<template>
	<view :animation="animationData" @click="rotateAndScale" style="background:red;height:100rpx;width:100rpx"></view>
</template>

<script>
	import uniBadge  from '../../components/uni-badge/uni-badge.vue';
	export default{
	  data() {
	    return {
			animationData: {}
		}
	  },
	  onLoad(){
	    var animation = uni.createAnimation({
	      duration: 1000,
	        timingFunction: 'ease',
	    });
		this.animation = animation;
	  },
	  onUnload() {
	  	this.animationData={}
	  },
	  methods:{
	    rotateAndScale(){
	      // 旋转同时放大
		  var that = this;
	      this.animation.scale(2, 2).step()
	      this.animationData = this.animation.export();
		  setTimeout(function() {
		    that.animation.scale(1, 1).step({duration:0})
		    that.animationData = that.animation.export()
		  }.bind(this), 1000)
	    }
	  }
	}
</script>

<style>

</style>
